package _17作业.t4;

import java.util.Arrays;

public class Demo {


    public static void main(String[] args) {
        Integer[] i = {1,2,3,4,5};
        index(i,1,3);
        System.out.println(Arrays.toString(i));

        String[] strings = {"a","b","c","d","e"};
        index(strings,1,3);
        System.out.println(Arrays.toString(strings));
    }

    public static <T> void index(T[] arr,int index1,int index2){
        T i;
        i=arr[index1];
        arr[index1]=arr[index2];
        arr[index2]=i;


    }
}
